from syslogd.enums.Specifier import SpecifierDict
from syslogd.Utils import Utils



class ConfObject(object):
        
    def __init__(self,rules, spec,path,commented):
        
        self.rules = rules
        self.spec = SpecifierDict.get(spec)
        self.path = path
        self.commented = commented
        
    def __str__(self):
        r = ''
        for el in self.rules:
            r += el.__str__() + ';'
        if r.endswith(';'):
            r = r[:-1]
        return Utils.iif(self.commented == True, "#", '') + r + "\t\t\t" + \
               Utils.iif(self.spec == None, '', self.spec) + \
               self.path.__str__()